package com.example.demo_test;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.util.unit.DataSize;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.servlet.MultipartConfigElement;

//@MapperScan("com.example.demo_test.Dao")
@SpringBootApplication
@EnableJpaRepositories
@EnableScheduling
@EnableSwagger2
@Configuration
public class DemoTestApplication {
    public static void main(String[] args) {
        SpringApplication.run( DemoTestApplication.class, args );
    }
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //允许上传的文件最大值
        factory.setMaxFileSize( DataSize.parse( "50MB" ) ); //KB,MB
        /// 设置总上传数据总大小
        factory.setMaxRequestSize( DataSize.parse( "50MB" ) );
        return factory.createMultipartConfig();
    }
}
